home *** CD-ROM | disk | FTP | other *** search
/ The Complete Utilities To…ka 501 Killer Utilities! / 501 Killer Utilities! (Macworld July 1995).cdr / Programming / metro-c-cpp-121 / C_C++_1.2.1 / INTO ‘Libraries’ / SIOUX / console.stubs.c next >
Encoding:
C/C++ Source or Header  |  1995-01-30  |  2.3 KB  |  90 lines  |  [TEXT/MMCC]

  1. /************************************************************************/
  2. /*    Project...:    Standard ANSI-C Library                                    */
  3. /*    Name......:    console.c                                                */
  4. /*    Purpose...:    Stubs for console.c                                        */
  5. /*  Copyright.: ©Copyright 1994 by metrowerks inc. All rights reserved. */
  6. /************************************************************************/
  7.  
  8. #ifndef __CONSOLE__
  9. #include <console.h>
  10. #endif
  11.  
  12. #define    UNUSED_ARG(x)        &x
  13.  
  14. /*
  15.  *    The following four functions provide the UI for the console package.
  16.  *    Users wishing to replace SIOUX with their own console package need
  17.  *    only provide the four functions below in a library.
  18.  */
  19.  
  20. /*
  21.  *    extern short InstallConsole(short fd);
  22.  *
  23.  *    Installs the Console package, this function will be called right
  24.  *    before any read or write to one of the standard streams.
  25.  *
  26.  *    short fd:        The stream which we are reading/writing to/from.
  27.  *    returns short:    0 no error occurred, anything else error.
  28.  */
  29.  
  30. short InstallConsole(short fd)
  31. {
  32.     UNUSED_ARG(fd);
  33.  
  34.     return 0;
  35. }
  36.  
  37. /*
  38.  *    extern void RemoveConsole(void);
  39.  *
  40.  *    Removes the console package.  It is called after all other streams
  41.  *    are closed and exit functions (installed by either atexit or _atexit)
  42.  *    have been called.  Since there is no way to recover from an error,
  43.  *    this function doesn't need to return any.
  44.  */
  45.  
  46. void RemoveConsole(void)
  47. {
  48. }
  49.  
  50. /*
  51.  *    extern long WriteCharsToConsole(char *buffer, long n);
  52.  *
  53.  *    Writes a stream of output to the Console window.  This function is
  54.  *    called by write.
  55.  *
  56.  *    char *buffer:    Pointer to the buffer to be written.
  57.  *    long n:            The length of the buffer to be written.
  58.  *    returns short:    Actual number of characters written to the stream,
  59.  *                    -1 if an error occurred.
  60.  */
  61.  
  62. long WriteCharsToConsole(char *buffer, long n)
  63. {
  64.     UNUSED_ARG(buffer);
  65.     UNUSED_ARG(n);
  66.  
  67.     return 0;
  68. }
  69.  
  70. /*
  71.  *    extern long ReadCharsFromConsole(char *buffer, long n);
  72.  *
  73.  *    Reads from the Console into a buffer.  This function is called by
  74.  *    read.
  75.  *
  76.  *    char *buffer:    Pointer to the buffer which will recieve the input.
  77.  *    long n:            The maximum amount of characters to be read (size of
  78.  *                    buffer).
  79.  *    returns short:    Actual number of characters read from the stream,
  80.  *                    -1 if an error occurred.
  81.  */
  82.  
  83. long ReadCharsFromConsole(char *buffer, long n)
  84. {
  85.     UNUSED_ARG(buffer);
  86.     UNUSED_ARG(n);
  87.  
  88.     return 0;
  89. }
  90.